﻿@{
    ViewBag.Title = "" + FOResource.UI.Product.Deposit.depositsavingname + "";
    Layout = "~/Views/Shared/_Layout.cshtml";
    var Cate = (List<FOModels.DepositSaving.DepositSavingCateModels>)ViewBag.DepositSavingCate;
    var list = (List<FOModels.DepositSaving.DepositSavingModels>)ViewBag.DepositSaving;
    var i = 1;
    double lai = 0;
    var ProDes = (FOModels.Product.ProductModels)ViewBag.ProDes;
}
<script type="text/javascript">
    var AppUrl = $("#AppUrl").text();
    var lang = $("#CurrentLangCode").html();
    var urlvnbanknet = "http://vnbanknet.com/Content/UpLoad/Images";
    if (lang == "vi-VN") {
        $("#amount-saving").change(function () {
            $.mobile.showPageLoadingMsg();
            var a = $(this).val().replace(".", "").replace(".", "").replace(".", "");
            var max = 1000000000;
            var min = 10000000;
            if (a > max) {
                $("#amount-saving").val(number_format(max, 0, ",", "."));
            }
            if (a < min) {
                $("#amount-saving").val(number_format(min, 0, ",", "."));
            }
            a = $(this).val().replace(".", "").replace(".", "").replace(".", "");

            if ($("#years-saving").val() < 1) {
                var val_month = $("#month-saving").val();
            }
            else {
                var val_month = $("#years-saving").val() * 12;
            }
            var ba = parseFloat(a);
            var interes = 0;
            $("#amount-saving").val(number_format(a, 0, ",", "."));
            var val_cate = $("#rel_cate").html();
            $.ajax({
                type: "post",
                url: AppUrl + "/DepositSaving/getDepositSaving",
                data: { cateid: val_cate, balance: ba, month: val_month },
                dataType: "json",
                success: function (rvdata) {
                    var htmlcode = "";
                    if (rvdata.length > 0) {
                        $(rvdata).each(function (index, item) {
                            if (val_cate == 1) {
                                interes = Math.pow(1 + ((item.InterestVND) / 100 / 12), val_month);
                                var ina = Math.round(parseFloat(interes * ba));
                                htmlcode += "     <tr class='views-row-first'>";
                                htmlcode += "   <td class='views-field views-field-name muted'>";
                                htmlcode += "     <strong><a title='" + item.DepositSavingName + "' class='name-product-list ui-link' href='" + AppUrl + "/term-saving/" + convertounsign(item.CompanyName).toLowerCase() + "/" + convertounsign(item.DepositSavingName).toLowerCase() + "/" + item.DepositSavingID + "'>" + item.DepositSavingName + "</a>";
                                htmlcode += "      <br />";
                                htmlcode += "     <a  title='" + item.CompanyName + "' href='" + AppUrl + "/term-saving/" + convertounsign(item.CompanyName).toLowerCase() + "/" + item.CompanyID + "'>";
                                htmlcode += "       <img class='img-logo-bank' src='" + urlvnbanknet + "/" + item.CompanyImg + "' /></a>";
                                htmlcode += "       </strong></td>";
                                if (item.InterestVND != 0) {
                                    htmlcode += "   <td class='cl-mid highlight-blue interest-rate-data value'>";
                                    htmlcode += "     <span class='highlight-blue interest-rate'>" + item.InterestVND.toString().replace(".", ",") + " %</span><br>";
                                    htmlcode += "    </td>";
                                    htmlcode += "    <td class='cl-mid value'>";
                                    htmlcode += "       <div class='highlight-blue total-interest'>" + number_format(ina, 0, ",", ".") + "</div>";
                                    htmlcode += "      <div class='interest-period muted'></div>";
                                    htmlcode += "   </td>";
                                }
                                else {
                                    htmlcode += "   <td class='cl-mid highlight-blue interest-rate-data value' colspan='2'>";
                                    htmlcode += "     <span class='highlight-blue interest-rate'>Liên hệ</span><br>";                                   
                                    htmlcode += "   </td>";
                                }
                                htmlcode += "   <td class='cl-mid text-center'><a href='" + AppUrl + "/term-saving/apply/" + item.DepositSavingID + "' data-role='button' data-icon='arrow-r' data-iconpos='notext' data-theme='c' data-inline='true' data-corners='true' data-shadow='true' data-iconshadow='true' data-wrapperels='span' title='Tham gia' class='ui-btn ui-shadow ui-btn-corner-all ui-btn-inline ui-btn-icon-notext ui-btn-up-c'><span class='ui-btn-inner'><span class='ui-btn-text'>Tham gia</span><span class='ui-icon ui-icon-arrow-r ui-icon-shadow'>&nbsp;</span></span></a></td>";
                                htmlcode += "  </tr>";

                            }
                            else {
                                interes = ba * val_month * ((item.InterestVND) / 100 / 12);
                                var ina = Math.round(parseFloat(interes + ba));
                                htmlcode += "     <tr class='views-row-first'>";
                                htmlcode += "   <td class='views-field views-field-name muted'>";
                                htmlcode += "     <strong><a title='" + item.DepositSavingName + "' class='name-product-list ui-link' href='" + AppUrl + "/term-saving/" + convertounsign(item.CompanyName).toLowerCase() + "/" + convertounsign(item.DepositSavingName).toLowerCase() + "/" + item.DepositSavingID + "'>" + item.DepositSavingName + "</a>";
                                htmlcode += "      <br />";
                                htmlcode += "     <a  title='" + item.CompanyName + "' href='" + AppUrl + "/term-saving/" + convertounsign(item.CompanyName).toLowerCase() + "/" + item.CompanyID + "'>";
                                htmlcode += "       <img class='img-logo-bank' src='" + urlvnbanknet + "/" + item.CompanyImg + "' /></a>";
                                htmlcode += "       </strong></td>";
                                if (item.InterestVND != 0) {
                                    htmlcode += "   <td class='cl-mid highlight-blue interest-rate-data value'>";
                                    htmlcode += "     <span class='highlight-blue interest-rate'>" + item.InterestVND.toString().replace(".", ",") + " %</span><br>";
                                    htmlcode += "    </td>";
                                    htmlcode += "    <td class='cl-mid value'>";
                                    htmlcode += "       <div class='highlight-blue total-interest'>" + number_format(ina, 0, ",", ".") + "</div>";
                                    htmlcode += "      <div class='interest-period muted'></div>";
                                    htmlcode += "   </td>";
                                }
                                else {
                                    htmlcode += "   <td class='cl-mid highlight-blue interest-rate-data value' colspan='2'>";
                                    htmlcode += "     <span class='highlight-blue interest-rate'>Liên hệ</span><br>";
                                    htmlcode += "   </td>";
                                }
                                htmlcode += "   <td class='cl-mid text-center'><a href='" + AppUrl + "/term-saving/apply/" + item.DepositSavingID + "' data-role='button' data-icon='arrow-r' data-iconpos='notext' data-theme='c' data-inline='true' data-corners='true' data-shadow='true' data-iconshadow='true' data-wrapperels='span' title='Tham gia' class='ui-btn ui-shadow ui-btn-corner-all ui-btn-inline ui-btn-icon-notext ui-btn-up-c'><span class='ui-btn-inner'><span class='ui-btn-text'>Tham gia</span><span class='ui-icon ui-icon-arrow-r ui-icon-shadow'>&nbsp;</span></span></a></td>";
                                htmlcode += "  </tr>";
                            }
                        });
                    }
                    else {
                        htmlcode += "<td colspan='4' style='margin-top: 10px;font-weight: bold;text-align: center;margin-bottom: 10px;'>Không có dữ liệu phù hợp<p></p></td>";
                    }
                    $("#pro-list").html(htmlcode);
                }

            });
            $.mobile.hidePageLoadingMsg();
        });
    }
    else {
        $("#amount-saving").change(function () {
            $.mobile.showPageLoadingMsg();
            var a = $(this).val().replace(",", "").replace(",", "").replace(",", "");
            var max = 1000000000;
            var min = 10000000;
            if (a > max) {
                $("#amount-saving").val(number_format(max, 0, ".", ","));
            }
            if (a < min) {
                $("#amount-saving").val(number_format(min, 0, ".", ","));
            }
            a = $(this).val().replace(",", "").replace(",", "").replace(",", "");

            if ($("#years-saving").val() < 1) {
                var val_month = $("#month-saving").val();
            }
            else {
                var val_month = $("#years-saving").val() * 12;
            }
            var ba = parseFloat(a);
            var interes = 0;
            $("#amount-saving").val(number_format(a, 0, ".", ","));
            var val_cate = $("#rel_cate").html();
            $.ajax({
                type: "post",
                url: AppUrl + "/DepositSaving/getDepositSaving",
                data: { cateid: val_cate, balance: ba, month: val_month },
                dataType: "json",
                success: function (rvdata) {
                    var htmlcode = "";
                    if (rvdata.length > 0) {
                        $(rvdata).each(function (index, item) {
                            if (val_cate == 1) {
                                interes = Math.pow(1 + ((item.InterestVND) / 100 / 12), val_month);
                                var ina = Math.round(parseFloat(interes * ba));
                                htmlcode += "     <tr class='views-row-first'>";
                                htmlcode += "   <td class='views-field views-field-name muted'>";
                                htmlcode += "     <strong><a title='" + item.DepositSavingName + "' class='name-product-list ui-link' href='" + AppUrl + "/term-saving/" + convertounsign(item.CompanyName).toLowerCase() + "/" + convertounsign(item.DepositSavingName).toLowerCase() + "/" + item.DepositSavingID + "'>" + item.DepositSavingName + "</a>";
                                htmlcode += "      <br />";
                                htmlcode += "     <a  title='" + item.CompanyName + "' href='" + AppUrl + "/term-saving/" + convertounsign(item.CompanyName).toLowerCase() + "/" + item.CompanyID + "'>";
                                htmlcode += "       <img class='img-logo-bank' src='" + urlvnbanknet + "/" + item.CompanyImg + "' /></a>";
                                htmlcode += "       </strong></td>";
                                if (item.InterestVND != 0) {
                                    htmlcode += "   <td class='cl-mid highlight-blue interest-rate-data value'>";
                                    htmlcode += "     <span class='highlight-blue interest-rate'>" + item.InterestVND + " %</span><br>";
                                    htmlcode += "    </td>";
                                    htmlcode += "    <td class='cl-mid value'>";
                                    htmlcode += "       <div class='highlight-blue total-interest'>" + number_format(ina, 0, ",", ".") + "</div>";
                                    htmlcode += "      <div class='interest-period muted'></div>";
                                    htmlcode += "   </td>";
                                }
                                else {
                                    htmlcode += "   <td class='cl-mid highlight-blue interest-rate-data value' colspan='2'>";
                                    htmlcode += "     <span class='highlight-blue interest-rate'>Contact</span><br>";
                                    htmlcode += "   </td>";
                                }
                                htmlcode += "   <td class='cl-mid text-center'><a href='" + AppUrl + "/term-saving/apply/" + item.DepositSavingID + "' data-role='button' data-icon='arrow-r' data-iconpos='notext' data-theme='c' data-inline='true' data-corners='true' data-shadow='true' data-iconshadow='true' data-wrapperels='span' title='Apply' class='ui-btn ui-shadow ui-btn-corner-all ui-btn-inline ui-btn-icon-notext ui-btn-up-c'><span class='ui-btn-inner'><span class='ui-btn-text'>Apply</span><span class='ui-icon ui-icon-arrow-r ui-icon-shadow'>&nbsp;</span></span></a></td>";
                                htmlcode += "  </tr>";

                            }
                            else {
                                interes = ba * val_month * ((item.InterestVND) / 100 / 12);
                                var ina = Math.round(parseFloat(interes + ba));
                                htmlcode += "     <tr class='views-row-first'>";
                                htmlcode += "   <td class='views-field views-field-name muted'>";
                                htmlcode += "     <strong><a title='" + item.DepositSavingName + "' class='name-product-list ui-link' href='" + AppUrl + "/term-saving/" + convertounsign(item.CompanyName).toLowerCase() + "/" + convertounsign(item.DepositSavingName).toLowerCase() + "/" + item.DepositSavingID + "'>" + item.DepositSavingName + "</a>";
                                htmlcode += "      <br />";
                                htmlcode += "     <a  title='" + item.CompanyName + "' href='" + AppUrl + "/term-saving/" + convertounsign(item.CompanyName).toLowerCase() + "/" + item.CompanyID + "'>";
                                htmlcode += "       <img class='img-logo-bank' src='" + urlvnbanknet + "/" + item.CompanyImg + "' /></a>";
                                htmlcode += "       </strong></td>";
                                if (item.InterestVND != 0) {
                                    htmlcode += "   <td class='cl-mid highlight-blue interest-rate-data value'>";
                                    htmlcode += "     <span class='highlight-blue interest-rate'>" + item.InterestVND + " %</span><br>";
                                    htmlcode += "    </td>";
                                    htmlcode += "    <td class='cl-mid value'>";
                                    htmlcode += "       <div class='highlight-blue total-interest'>" + number_format(ina, 0, ",", ".") + "</div>";
                                    htmlcode += "      <div class='interest-period muted'></div>";
                                    htmlcode += "   </td>";
                                }
                                else {
                                    htmlcode += "   <td class='cl-mid highlight-blue interest-rate-data value' colspan='2'>";
                                    htmlcode += "     <span class='highlight-blue interest-rate'>Contact</span><br>";
                                    htmlcode += "   </td>";
                                }
                                htmlcode += "   <td class='cl-mid text-center'><a href='" + AppUrl + "/term-saving/apply/" + item.DepositSavingID + "' data-role='button' data-icon='arrow-r' data-iconpos='notext' data-theme='c' data-inline='true' data-corners='true' data-shadow='true' data-iconshadow='true' data-wrapperels='span' title='Apply' class='ui-btn ui-shadow ui-btn-corner-all ui-btn-inline ui-btn-icon-notext ui-btn-up-c'><span class='ui-btn-inner'><span class='ui-btn-text'>Apply</span><span class='ui-icon ui-icon-arrow-r ui-icon-shadow'>&nbsp;</span></span></a></td>";
                                htmlcode += "  </tr>";
                            }
                        });
                    }

                    else {
                        htmlcode += "<td colspan='4' style='margin-top: 10px;font-weight: bold;text-align: center;margin-bottom: 10px;'>No result<p></p></td>";
                    }
                    $("#pro-list").html(htmlcode);
                }

            });
            $.mobile.hidePageLoadingMsg();
        });
    }
    if (lang == "vi-VN") {
        $("#years-saving").change(function () {
            $.mobile.showPageLoadingMsg();
            var years = parseInt($('#years-saving').val(), 10);
            var months = parseInt($('#month-saving').val(), 10);
            var max = 5;
            var min = 0;
            if (years == 0 && months == 0) {
                $("#month-saving").val(1);
            }
            else if (years == 0 && months == 1) {
                $("#month-saving").val(1);
            }
            else if (years > max) {
                $("#years-saving").val(max);
                $("#month-saving").val(0);
            }
            else if (years < min) {
                $("#years-saving").val(min);
                $("#month-saving").val(1);
            }
            else {
                $("#years-saving").val(years);
                $("#month-saving").val(0);
            }
            if ($("#years-saving").val() < 1) {
                var val_month = $("#month-saving").val();
            }
            else {
                var val_month = $("#years-saving").val() * 12;
            }
            var a = $("#amount-saving").val().replace(".", "").replace(".", "").replace(".", "");
            var ba = parseFloat(a);
            var interes = 0;
            var val_cate = $("#rel_cate").html();
            $.ajax({
                type: "post",
                url: AppUrl + "/DepositSaving/getDepositSaving",
                data: { cateid: val_cate, balance: ba, month: val_month },
                dataType: "json",
                success: function (rvdata) {
                    var htmlcode = "";
                    if (rvdata.length > 0) {
                        $(rvdata).each(function (index, item) {
                            if (val_cate == 1) {
                                interes = Math.pow(1 + ((item.InterestVND) / 100 / 12), val_month);
                                var ina = Math.round(parseFloat(interes * ba));
                                htmlcode += "     <tr class='views-row-first'>";
                                htmlcode += "   <td class='views-field views-field-name muted'>";
                                htmlcode += "     <strong><a title='" + item.DepositSavingName + "' class='name-product-list ui-link' href='" + AppUrl + "/term-saving/" + convertounsign(item.CompanyName).toLowerCase() + "/" + convertounsign(item.DepositSavingName).toLowerCase() + "/" + item.DepositSavingID + "'>" + item.DepositSavingName + "</a>";
                                htmlcode += "      <br />";
                                htmlcode += "     <a  title='" + item.CompanyName + "' href='" + AppUrl + "/term-saving/" + convertounsign(item.CompanyName).toLowerCase() + "/" + item.CompanyID + "'>";
                                htmlcode += "       <img class='img-logo-bank' src='" + urlvnbanknet + "/" + item.CompanyImg + "' /></a>";
                                htmlcode += "       </strong></td>";
                                if (item.InterestVND != 0) {
                                    htmlcode += "   <td class='cl-mid highlight-blue interest-rate-data value'>";
                                    htmlcode += "     <span class='highlight-blue interest-rate'>" + item.InterestVND.toString().replace(".", ",") + " %</span><br>";
                                    htmlcode += "    </td>";
                                    htmlcode += "    <td class='cl-mid value'>";
                                    htmlcode += "       <div class='highlight-blue total-interest'>" + number_format(ina, 0, ",", ".") + "</div>";
                                    htmlcode += "      <div class='interest-period muted'></div>";
                                    htmlcode += "   </td>";
                                }
                                else {
                                    htmlcode += "   <td class='cl-mid highlight-blue interest-rate-data value' colspan='2'>";
                                    htmlcode += "     <span class='highlight-blue interest-rate'>Liên hệ</span><br>";
                                    htmlcode += "   </td>";
                                }
                                htmlcode += "   <td class='cl-mid text-center'><a href='" + AppUrl + "/term-saving/apply/" + item.DepositSavingID + "' data-role='button' data-icon='arrow-r' data-iconpos='notext' data-theme='c' data-inline='true' data-corners='true' data-shadow='true' data-iconshadow='true' data-wrapperels='span' title='Tham gia' class='ui-btn ui-shadow ui-btn-corner-all ui-btn-inline ui-btn-icon-notext ui-btn-up-c'><span class='ui-btn-inner'><span class='ui-btn-text'>Tham gia</span><span class='ui-icon ui-icon-arrow-r ui-icon-shadow'>&nbsp;</span></span></a></td>";
                                htmlcode += "  </tr>";

                            }
                            else {
                                interes = ba * val_month * ((item.InterestVND) / 100 / 12);
                                var ina = Math.round(parseFloat(interes + ba));
                                htmlcode += "     <tr class='views-row-first'>";
                                htmlcode += "   <td class='views-field views-field-name muted'>";
                                htmlcode += "     <strong><a title='" + item.DepositSavingName + "' class='name-product-list ui-link' href='" + AppUrl + "/term-saving/" + convertounsign(item.CompanyName).toLowerCase() + "/" + convertounsign(item.DepositSavingName).toLowerCase() + "/" + item.DepositSavingID + "'>" + item.DepositSavingName + "</a>";
                                htmlcode += "      <br />";
                                htmlcode += "     <a  title='" + item.CompanyName + "' href='" + AppUrl + "/term-saving/" + convertounsign(item.CompanyName).toLowerCase() + "/" + item.CompanyID + "'>";
                                htmlcode += "       <img class='img-logo-bank' src='" + urlvnbanknet + "/" + item.CompanyImg + "' /></a>";
                                htmlcode += "       </strong></td>";
                                if (item.InterestVND != 0) {
                                    htmlcode += "   <td class='cl-mid highlight-blue interest-rate-data value'>";
                                    htmlcode += "     <span class='highlight-blue interest-rate'>" + item.InterestVND.toString().replace(".", ",") + " %</span><br>";
                                    htmlcode += "    </td>";
                                    htmlcode += "    <td class='cl-mid value'>";
                                    htmlcode += "       <div class='highlight-blue total-interest'>" + number_format(ina, 0, ",", ".") + "</div>";
                                    htmlcode += "      <div class='interest-period muted'></div>";
                                    htmlcode += "   </td>";
                                }
                                else {
                                    htmlcode += "   <td class='cl-mid highlight-blue interest-rate-data value' colspan='2'>";
                                    htmlcode += "     <span class='highlight-blue interest-rate'>Liên hệ</span><br>";
                                    htmlcode += "   </td>";
                                }
                                htmlcode += "   <td class='cl-mid text-center'><a href='" + AppUrl + "/term-saving/apply/" + item.DepositSavingID + "' data-role='button' data-icon='arrow-r' data-iconpos='notext' data-theme='c' data-inline='true' data-corners='true' data-shadow='true' data-iconshadow='true' data-wrapperels='span' title='Tham gia' class='ui-btn ui-shadow ui-btn-corner-all ui-btn-inline ui-btn-icon-notext ui-btn-up-c'><span class='ui-btn-inner'><span class='ui-btn-text'>Tham gia</span><span class='ui-icon ui-icon-arrow-r ui-icon-shadow'>&nbsp;</span></span></a></td>";
                                htmlcode += "  </tr>";
                            }
                        });
                    }

                    else {
                        htmlcode = "<tr><td colspan='4' style='text-align:center;'><tr><td colspan='6' style='margin-top: 10px;font-weight: bold;text-align: center;margin-bottom: 10px;'>Không có dữ liệu phù hợp</p></td></tr></td></tr>";
                    }
                    $("#pro-list").html(htmlcode);
                }

            });
            $.mobile.hidePageLoadingMsg();
        });
        $("#month-saving").change(function () {
            $.mobile.showPageLoadingMsg();
            var years = parseInt($('#years-saving').val(), 10);
            var months = parseInt($('#month-saving').val(), 10);
            if (years == 0 && months == 0) {
                $('#month-saving').val(1);
            } else if (months < 12) {
                if (years == 0) {
                    $('#month-saving').val(months);
                }
                else if (years > 0 && years < 5) {
                    $('#month-saving').val(years + 1);
                    $('#month-saving').val(0);
                }
                else {
                    $('#month-saving').val(0);
                }
            }
            else {
                if (years == 0) {
                    $('#years-saving').val(years + 1);
                    $('#month-saving').val(0);
                }
                else if (years > 0 && years < 5) {
                    $('#years-saving').val(years + 1);
                    $('#month-saving').val(0);
                }
                else {
                    $('#month-saving').val(0);
                }
            }
            if ($("#years-saving").val() < 1) {
                var val_month = $("#month-saving").val();
            }
            else {
                var val_month = $("#years-saving").val() * 12;
            }
            var a = $("#amount-saving").val().replace(".", "").replace(".", "").replace(".", "");
            var ba = parseFloat(a);
            var interes = 0;
            var val_cate = $("#rel_cate").html();
            $.ajax({
                type: "post",
                url: AppUrl + "/DepositSaving/getDepositSaving",
                data: { cateid: val_cate, balance: ba, month: val_month },
                dataType: "json",
                success: function (rvdata) {
                    var htmlcode = "";
                    if (rvdata.length > 0) {
                        $(rvdata).each(function (index, item) {
                            if (val_cate == 1) {
                                interes = Math.pow(1 + ((item.InterestVND) / 100 / 12), val_month);
                                var ina = Math.round(parseFloat(interes * ba));
                                htmlcode += "     <tr class='views-row-first'>";
                                htmlcode += "   <td class='views-field views-field-name muted'>";
                                htmlcode += "     <strong><a title='" + item.DepositSavingName + "' class='name-product-list ui-link' href='" + AppUrl + "/term-saving/" + convertounsign(item.CompanyName).toLowerCase() + "/" + convertounsign(item.DepositSavingName).toLowerCase() + "/" + item.DepositSavingID + "'>" + item.DepositSavingName + "</a>";
                                htmlcode += "      <br />";
                                htmlcode += "     <a  title='" + item.CompanyName + "' href='" + AppUrl + "/term-saving/" + convertounsign(item.CompanyName).toLowerCase() + "/" + item.CompanyID + "'>";
                                htmlcode += "       <img class='img-logo-bank' src='" + urlvnbanknet + "/" + item.CompanyImg + "' /></a>";
                                htmlcode += "       </strong></td>";
                                if (item.InterestVND != 0) {
                                    htmlcode += "   <td class='cl-mid highlight-blue interest-rate-data value'>";
                                    htmlcode += "     <span class='highlight-blue interest-rate'>" + item.InterestVND.toString().replace(".", ",") + " %</span><br>";
                                    htmlcode += "    </td>";
                                    htmlcode += "    <td class='cl-mid value'>";
                                    htmlcode += "       <div class='highlight-blue total-interest'>" + number_format(ina, 0, ",", ".") + "</div>";
                                    htmlcode += "      <div class='interest-period muted'></div>";
                                    htmlcode += "   </td>";
                                }
                                else {
                                    htmlcode += "   <td class='cl-mid highlight-blue interest-rate-data value' colspan='2'>";
                                    htmlcode += "     <span class='highlight-blue interest-rate'>Liên hệ</span><br>";
                                    htmlcode += "   </td>";
                                }
                                htmlcode += "   <td class='cl-mid text-center'><a href='" + AppUrl + "/term-saving/apply/" + item.DepositSavingID + "' data-role='button' data-icon='arrow-r' data-iconpos='notext' data-theme='c' data-inline='true' data-corners='true' data-shadow='true' data-iconshadow='true' data-wrapperels='span' title='Tham gia' class='ui-btn ui-shadow ui-btn-corner-all ui-btn-inline ui-btn-icon-notext ui-btn-up-c'><span class='ui-btn-inner'><span class='ui-btn-text'>Tham gia</span><span class='ui-icon ui-icon-arrow-r ui-icon-shadow'>&nbsp;</span></span></a></td>";
                                htmlcode += "  </tr>";

                            }
                            else {
                                interes = ba * val_month * ((item.InterestVND) / 100 / 12);
                                var ina = Math.round(parseFloat(interes + ba));
                                htmlcode += "     <tr class='views-row-first'>";
                                htmlcode += "   <td class='views-field views-field-name muted'>";
                                htmlcode += "     <strong><a title='" + item.DepositSavingName + "' class='name-product-list ui-link' href='" + AppUrl + "/term-saving/" + convertounsign(item.CompanyName).toLowerCase() + "/" + convertounsign(item.DepositSavingName).toLowerCase() + "/" + item.DepositSavingID + "'>" + item.DepositSavingName + "</a>";
                                htmlcode += "      <br />";
                                htmlcode += "     <a  title='" + item.CompanyName + "' href='" + AppUrl + "/term-saving/" + convertounsign(item.CompanyName).toLowerCase() + "/" + item.CompanyID + "'>";
                                htmlcode += "       <img class='img-logo-bank' src='" + urlvnbanknet + "/" + item.CompanyImg + "' /></a>";
                                htmlcode += "       </strong></td>";
                                if (item.InterestVND != 0) {
                                    htmlcode += "   <td class='cl-mid highlight-blue interest-rate-data value'>";
                                    htmlcode += "     <span class='highlight-blue interest-rate'>" + item.InterestVND.toString().replace(".", ",") + " %</span><br>";
                                    htmlcode += "    </td>";
                                    htmlcode += "    <td class='cl-mid value'>";
                                    htmlcode += "       <div class='highlight-blue total-interest'>" + number_format(ina, 0, ",", ".") + "</div>";
                                    htmlcode += "      <div class='interest-period muted'></div>";
                                    htmlcode += "   </td>";
                                }
                                else {
                                    htmlcode += "   <td class='cl-mid highlight-blue interest-rate-data value' colspan='2'>";
                                    htmlcode += "     <span class='highlight-blue interest-rate'>Liên hệ</span><br>";
                                    htmlcode += "   </td>";
                                }
                                htmlcode += "   <td class='cl-mid text-center'><a href='" + AppUrl + "/term-saving/apply/" + item.DepositSavingID + "' data-role='button' data-icon='arrow-r' data-iconpos='notext' data-theme='c' data-inline='true' data-corners='true' data-shadow='true' data-iconshadow='true' data-wrapperels='span' title='Tham gia' class='ui-btn ui-shadow ui-btn-corner-all ui-btn-inline ui-btn-icon-notext ui-btn-up-c'><span class='ui-btn-inner'><span class='ui-btn-text'>Tham gia</span><span class='ui-icon ui-icon-arrow-r ui-icon-shadow'>&nbsp;</span></span></a></td>";
                                htmlcode += "  </tr>";
                            }
                        });
                    }

                    else {
                        htmlcode = "<tr><td colspan='4' style='text-align:center;'><tr><td colspan='6' style='margin-top: 10px;font-weight: bold;text-align: center;margin-bottom: 10px;'>Không có dữ liệu phù hợp</p></td></tr></td></tr>";
                    }
                    $("#pro-list").html(htmlcode);
                }

            });
            $.mobile.hidePageLoadingMsg();
        });
    }
    else {
        $("#years-saving").change(function () {
            $.mobile.showPageLoadingMsg();
            var years = parseInt($('#years-saving').val(), 10);
            var months = parseInt($('#month-saving').val(), 10);
            var max = 5;
            var min = 0;
            if (years == 0 && months == 0) {
                $("#month-saving").val(1);
            }
            else if (years == 0 && months == 1) {
                $("#month-saving").val(1);
            }
            else if (years > max) {
                $("#years-saving").val(max);
                $("#month-saving").val(0);
            }
            else if (years < min) {
                $("#years-saving").val(min);
                $("#month-saving").val(1);
            }
            else {
                $("#years-saving").val(years);
                $("#month-saving").val(0);
            }
            if ($("#years-saving").val() < 1) {
                var val_month = $("#month-saving").val();
            }
            else {
                var val_month = $("#years-saving").val() * 12;
            }
            var a = $("#amount-saving").val().replace(".", "").replace(".", "").replace(".", "");
            var ba = parseFloat(a);
            var interes = 0;
            var val_cate = $("#rel_cate").html();
            $.ajax({
                type: "post",
                url: AppUrl + "/DepositSaving/getDepositSaving",
                data: { cateid: val_cate, balance: ba, month: val_month },
                dataType: "json",
                success: function (rvdata) {
                    var htmlcode = "";
                    if (rvdata.length > 0) {
                        $(rvdata).each(function (index, item) {
                            if (val_cate == 1) {
                                interes = Math.pow(1 + ((item.InterestVND) / 100 / 12), val_month);
                                var ina = Math.round(parseFloat(interes * ba));
                                htmlcode += "     <tr class='views-row-first'>";
                                htmlcode += "   <td class='views-field views-field-name muted'>";
                                htmlcode += "     <strong><a title='" + item.DepositSavingName + "' class='name-product-list ui-link' href='" + AppUrl + "/term-saving/" + convertounsign(item.CompanyName).toLowerCase() + "/" + convertounsign(item.DepositSavingName).toLowerCase() + "/" + item.DepositSavingID + "'>" + item.DepositSavingName + "</a>";
                                htmlcode += "      <br />";
                                htmlcode += "     <a  title='" + item.CompanyName + "' href='" + AppUrl + "/term-saving/" + convertounsign(item.CompanyName).toLowerCase() + "/" + item.CompanyID + "'>";
                                htmlcode += "       <img class='img-logo-bank' src='" + urlvnbanknet + "/" + item.CompanyImg + "' /></a>";
                                htmlcode += "       </strong></td>";
                                if (item.InterestVND != 0) {
                                    htmlcode += "   <td class='cl-mid highlight-blue interest-rate-data value'>";
                                    htmlcode += "     <span class='highlight-blue interest-rate'>" + item.InterestVND.toString().replace(".", ",") + " %</span><br>";
                                    htmlcode += "    </td>";
                                    htmlcode += "    <td class='cl-mid value'>";
                                    htmlcode += "       <div class='highlight-blue total-interest'>" + number_format(ina, 0, ",", ".") + "</div>";
                                    htmlcode += "      <div class='interest-period muted'></div>";
                                    htmlcode += "   </td>";
                                }
                                else {
                                    htmlcode += "   <td class='cl-mid highlight-blue interest-rate-data value' colspan='2'>";
                                    htmlcode += "     <span class='highlight-blue interest-rate'>Contact</span><br>";
                                    htmlcode += "   </td>";
                                }
                                htmlcode += "   <td class='cl-mid text-center'><a href='" + AppUrl + "/term-saving/apply/" + item.DepositSavingID + "' data-role='button' data-icon='arrow-r' data-iconpos='notext' data-theme='c' data-inline='true' data-corners='true' data-shadow='true' data-iconshadow='true' data-wrapperels='span' title='Apply' class='ui-btn ui-shadow ui-btn-corner-all ui-btn-inline ui-btn-icon-notext ui-btn-up-c'><span class='ui-btn-inner'><span class='ui-btn-text'>Apply</span><span class='ui-icon ui-icon-arrow-r ui-icon-shadow'>&nbsp;</span></span></a></td>";
                                htmlcode += "  </tr>";

                            }
                            else {
                                interes = ba * val_month * ((item.InterestVND) / 100 / 12);
                                var ina = Math.round(parseFloat(interes + ba));
                                htmlcode += "     <tr class='views-row-first'>";
                                htmlcode += "   <td class='views-field views-field-name muted'>";
                                htmlcode += "     <strong><a title='" + item.DepositSavingName + "' class='name-product-list ui-link' href='" + AppUrl + "/term-saving/" + convertounsign(item.CompanyName).toLowerCase() + "/" + convertounsign(item.DepositSavingName).toLowerCase() + "/" + item.DepositSavingID + "'>" + item.DepositSavingName + "</a>";
                                htmlcode += "      <br />";
                                htmlcode += "     <a  title='" + item.CompanyName + "' href='" + AppUrl + "/term-saving/" + convertounsign(item.CompanyName).toLowerCase() + "/" + item.CompanyID + "'>";
                                htmlcode += "       <img class='img-logo-bank' src='" + urlvnbanknet + "/" + item.CompanyImg + "' /></a>";
                                htmlcode += "       </strong></td>";
                                if (item.InterestVND != 0) {
                                    htmlcode += "   <td class='cl-mid highlight-blue interest-rate-data value'>";
                                    htmlcode += "     <span class='highlight-blue interest-rate'>" + item.InterestVND.toString().replace(".", ",") + " %</span><br>";
                                    htmlcode += "    </td>";
                                    htmlcode += "    <td class='cl-mid value'>";
                                    htmlcode += "       <div class='highlight-blue total-interest'>" + number_format(ina, 0, ",", ".") + "</div>";
                                    htmlcode += "      <div class='interest-period muted'></div>";
                                    htmlcode += "   </td>";
                                }
                                else {
                                    htmlcode += "   <td class='cl-mid highlight-blue interest-rate-data value' colspan='2'>";
                                    htmlcode += "     <span class='highlight-blue interest-rate'>Contact</span><br>";
                                    htmlcode += "   </td>";
                                }
                                htmlcode += "   <td class='cl-mid text-center'><a href='" + AppUrl + "/term-saving/apply/" + item.DepositSavingID + "' data-role='button' data-icon='arrow-r' data-iconpos='notext' data-theme='c' data-inline='true' data-corners='true' data-shadow='true' data-iconshadow='true' data-wrapperels='span' title='Apply' class='ui-btn ui-shadow ui-btn-corner-all ui-btn-inline ui-btn-icon-notext ui-btn-up-c'><span class='ui-btn-inner'><span class='ui-btn-text'>Apply</span><span class='ui-icon ui-icon-arrow-r ui-icon-shadow'>&nbsp;</span></span></a></td>";
                                htmlcode += "  </tr>";
                            }
                        });
                    }

                    else {
                        htmlcode = "<tr><td colspan='4' style='text-align:center;'><tr><td colspan='6' style='margin-top: 10px;font-weight: bold;text-align: center;margin-bottom: 10px;'>Không có dữ liệu phù hợp</p></td></tr></td></tr>";
                    }
                    $("#pro-list").html(htmlcode);
                }

            });
            $.mobile.hidePageLoadingMsg();
        });
        $("#month-saving").change(function () {
            $.mobile.showPageLoadingMsg();
            var years = parseInt($('#years-saving').val(), 10);
            var months = parseInt($('#month-saving').val(), 10);
            if (years == 0 && months == 0) {
                $('#month-saving').val(1);
            } else if (months < 12) {
                if (years == 0) {
                    $('#month-saving').val(months);
                }
                else if (years > 0 && years < 5) {
                    $('#month-saving').val(years + 1);
                    $('#month-saving').val(0);
                }
                else {
                    $('#month-saving').val(0);
                }
            }
            else {
                if (years == 0) {
                    $('#years-saving').val(years + 1);
                    $('#month-saving').val(0);
                }
                else if (years > 0 && years < 5) {
                    $('#years-saving').val(years + 1);
                    $('#month-saving').val(0);
                }
                else {
                    $('#month-saving').val(0);
                }
            }
            if ($("#years-saving").val() < 1) {
                var val_month = $("#month-saving").val();
            }
            else {
                var val_month = $("#years-saving").val() * 12;
            }
            var a = $("#amount-saving").val().replace(".", "").replace(".", "").replace(".", "");
            var ba = parseFloat(a);
            var interes = 0;
            var val_cate = $("#rel_cate").html();
            $.ajax({
                type: "post",
                url: AppUrl + "/DepositSaving/getDepositSaving",
                data: { cateid: val_cate, balance: ba, month: val_month },
                dataType: "json",
                success: function (rvdata) {
                    var htmlcode = "";
                    if (rvdata.length > 0) {
                        $(rvdata).each(function (index, item) {
                            if (val_cate == 1) {
                                interes = Math.pow(1 + ((item.InterestVND) / 100 / 12), val_month);
                                var ina = Math.round(parseFloat(interes * ba));
                                htmlcode += "     <tr class='views-row-first'>";
                                htmlcode += "   <td class='views-field views-field-name muted'>";
                                htmlcode += "     <strong><a title='" + item.DepositSavingName + "' class='name-product-list ui-link' href='" + AppUrl + "/term-saving/" + convertounsign(item.CompanyName).toLowerCase() + "/" + convertounsign(item.DepositSavingName).toLowerCase() + "/" + item.DepositSavingID + "'>" + item.DepositSavingName + "</a>";
                                htmlcode += "      <br />";
                                htmlcode += "     <a  title='" + item.CompanyName + "' href='" + AppUrl + "/term-saving/" + convertounsign(item.CompanyName).toLowerCase() + "/" + item.CompanyID + "'>";
                                htmlcode += "       <img class='img-logo-bank' src='" + urlvnbanknet + "/" + item.CompanyImg + "' /></a>";
                                htmlcode += "       </strong></td>";
                                if (item.InterestVND != 0) {
                                    htmlcode += "   <td class='cl-mid highlight-blue interest-rate-data value'>";
                                    htmlcode += "     <span class='highlight-blue interest-rate'>" + item.InterestVND.toString().replace(".", ",") + " %</span><br>";
                                    htmlcode += "    </td>";
                                    htmlcode += "    <td class='cl-mid value'>";
                                    htmlcode += "       <div class='highlight-blue total-interest'>" + number_format(ina, 0, ",", ".") + "</div>";
                                    htmlcode += "      <div class='interest-period muted'></div>";
                                    htmlcode += "   </td>";
                                }
                                else {
                                    htmlcode += "   <td class='cl-mid highlight-blue interest-rate-data value' colspan='2'>";
                                    htmlcode += "     <span class='highlight-blue interest-rate'>Contact</span><br>";
                                    htmlcode += "   </td>";
                                }
                                htmlcode += "   <td class='cl-mid text-center'><a href='" + AppUrl + "/term-saving/apply/" + item.DepositSavingID + "' data-role='button' data-icon='arrow-r' data-iconpos='notext' data-theme='c' data-inline='true' data-corners='true' data-shadow='true' data-iconshadow='true' data-wrapperels='span' title='Apply' class='ui-btn ui-shadow ui-btn-corner-all ui-btn-inline ui-btn-icon-notext ui-btn-up-c'><span class='ui-btn-inner'><span class='ui-btn-text'>Apply</span><span class='ui-icon ui-icon-arrow-r ui-icon-shadow'>&nbsp;</span></span></a></td>";
                                htmlcode += "  </tr>";

                            }
                            else {
                                interes = ba * val_month * ((item.InterestVND) / 100 / 12);
                                var ina = Math.round(parseFloat(interes + ba));
                                htmlcode += "     <tr class='views-row-first'>";
                                htmlcode += "   <td class='views-field views-field-name muted'>";
                                htmlcode += "     <strong><a title='" + item.DepositSavingName + "' class='name-product-list ui-link' href='" + AppUrl + "/term-saving/" + convertounsign(item.CompanyName).toLowerCase() + "/" + convertounsign(item.DepositSavingName).toLowerCase() + "/" + item.DepositSavingID + "'>" + item.DepositSavingName + "</a>";
                                htmlcode += "      <br />";
                                htmlcode += "     <a  title='" + item.CompanyName + "' href='" + AppUrl + "/term-saving/" + convertounsign(item.CompanyName).toLowerCase() + "/" + item.CompanyID + "'>";
                                htmlcode += "       <img class='img-logo-bank' src='" + urlvnbanknet + "/" + item.CompanyImg + "' /></a>";
                                htmlcode += "       </strong></td>";
                                if (item.InterestVND != 0) {
                                    htmlcode += "   <td class='cl-mid highlight-blue interest-rate-data value'>";
                                    htmlcode += "     <span class='highlight-blue interest-rate'>" + item.InterestVND.toString().replace(".", ",") + " %</span><br>";
                                    htmlcode += "    </td>";
                                    htmlcode += "    <td class='cl-mid value'>";
                                    htmlcode += "       <div class='highlight-blue total-interest'>" + number_format(ina, 0, ",", ".") + "</div>";
                                    htmlcode += "      <div class='interest-period muted'></div>";
                                    htmlcode += "   </td>";
                                }
                                else {
                                    htmlcode += "   <td class='cl-mid highlight-blue interest-rate-data value' colspan='2'>";
                                    htmlcode += "     <span class='highlight-blue interest-rate'>Contact</span><br>";
                                    htmlcode += "   </td>";
                                }
                                htmlcode += "   <td class='cl-mid text-center'><a href='" + AppUrl + "/term-saving/apply/" + item.DepositSavingID + "' data-role='button' data-icon='arrow-r' data-iconpos='notext' data-theme='c' data-inline='true' data-corners='true' data-shadow='true' data-iconshadow='true' data-wrapperels='span' title='Apply' class='ui-btn ui-shadow ui-btn-corner-all ui-btn-inline ui-btn-icon-notext ui-btn-up-c'><span class='ui-btn-inner'><span class='ui-btn-text'>Apply</span><span class='ui-icon ui-icon-arrow-r ui-icon-shadow'>&nbsp;</span></span></a></td>";
                                htmlcode += "  </tr>";
                            }
                        });
                    }

                    else {
                        htmlcode = "<tr><td colspan='4' style='text-align:center;'><tr><td colspan='6' style='margin-top: 10px;font-weight: bold;text-align: center;margin-bottom: 10px;'>Không có dữ liệu phù hợp</p></td></tr></td></tr>";
                    }
                    $("#pro-list").html(htmlcode);
                }

            });
            $.mobile.hidePageLoadingMsg();
        });
    }
</script>
<div style="padding: 10px; padding-bottom: 0px;">
    <div id="fixed-deposit-calculator" class="panel panel-large">
        <div id="calculator-form">
            <div class="field">
                <label class="color-text" for="amount">@FOResource.UI.Product.Deposit.moneytosaving</label>
                <div class="clr"></div>
                <div class="controls" >
                    <div class="input-prepend">
                        <input data-theme="b" class="amount" type="text" name="amount" value="50.000.000" id="amount-saving">
                        <span data-theme="b" class="add-on">VND</span>
                    </div>
                </div>
            </div>

            <div class="clr"></div>

            <div class="field">
                <label class="color-text" for="months">@FOResource.UI.Product.Deposit.timetosaving</label>

                <div class="clr"></div>
                <div class="controls">
                    <div class="input-append">
                        <input type="text" name="years" value="0" id="years-saving" class="time input-mini years">
                        <span class="add-on">@FOResource.UI.Layout.years</span>
                    </div>
                    <div class="input-append">
                        <input type="text" name="months" value="1" id="month-saving" class="time input-mini years">
                        <span class="add-on">@FOResource.UI.Product.Deposit.month</span>
                    </div>
                </div>
            </div>

            <div class="clr"></div>
            <fieldset data-mini="true" data-role="controlgroup" data-type="horizontal">
                <label class="color-text mar-10" for="months">@FOResource.UI.Layout.formsofsaving</label>
                @if (Cate.Count > 0)
                {
                    foreach (var ca in Cate)
                    {

                        if (i == 1)
                        {
                    <div id="rel_cate" style="display: none;">@ca.SavingDepositCategoryID</div>
                    <input onchange="return ajaxcateid('@ca.SavingDepositCategoryID')" type="radio" name="radio-choice-h-2" id="radio-choice-h-2a" value="on" checked="checked" />
                    <label  for="radio-choice-h-2a">@ca.SavingDepositCategoryName</label>
                        }
                        else
                        {
                    <input onchange="return ajaxcateid('@ca.SavingDepositCategoryID')" type="radio" name="radio-choice-h-2" id="radio-choice-h-2b" value="off" />
                    <label for="radio-choice-h-2b">@ca.SavingDepositCategoryName</label>
                        }
                        i = i + 1;
                    }

                }
            </fieldset>
        </div>
    </div>
</div>
<div class="container">
    <table data-role="table" id="table-custom-2" data-mode="" class="product-list ui-body-d ui-shadow table-stripe ui-responsive" data-column-btn-theme="b">
        <thead>
            <tr class="ui-bar-b">
                <th class="text-center">@FOResource.UI.Product.Card.lblbank</th>
                <th style="width: 15%" class="text-center">@FOResource.UI.Product.Deposit.interest %</th>
                <th class="text-center">@FOResource.UI.Product.Deposit.totalinterest (VND)</th>
                <th class="text-center">@FOResource.UI.Product.Card.lblapply1</th>
            </tr>
        </thead>
        <tbody id="pro-list">
            @if (list.Count > 0)
            {
                foreach (var l in list)
                {
                    lai = (1 + (l.InterestVND / 100 / 12)) * 50000000;
                <tr class="views-row-first">
                    <td class="views-field views-field-name muted">
                        <strong><a title="@l.DepositSavingName" class="name-product-list" href="@Url.Action("Detail", "DepositSaving", new { CompanyName = FO.Models.Conver.ConvertToUnSign(l.CompanyName).ToLower(), DepositSavingName = FO.Models.Conver.ConvertToUnSign(l.DepositSavingName).ToLower(), DepositSavingID = l.DepositSavingID })">@l.DepositSavingName</a>
                            <br />
                            <a title="@l.CompanyName" href="@Url.Action("TermSavingByProvider", "DepositSaving", new { CompanyName = FO.Models.Conver.ConvertToUnSign(l.CompanyName).ToLower(), CompanyID = l.CompanyID })">
                                <img class="img-logo-bank" src="@Url.Content("http://vnbanknet.com/Content/UpLoad/Images/" + l.CompanyImg + "")" /></a>
                        </strong></td>
                    @if(l.InterestVND!=0)
                    {
                    <td class="cl-mid highlight-blue interest-rate-data value">
                        <span class="highlight-blue interest-rate">@l.InterestVND.ToString().Replace(".", "" + FOResource.UI.Layout.currency1 + "") %</span><br>
                    </td>
                    <td class="cl-mid value">
                        <div class="highlight-blue total-interest">@String.Format("{0:0,0}", lai).Replace(".", "" + FOResource.UI.Layout.currency + "")</div>
                        <div class="interest-period muted"></div>
                    </td>
                    }
                    else
                    {
                       <td class="cl-mid highlight-blue interest-rate-data value" colspan="2">
                        <span class="highlight-blue interest-rate">@FOResource.UI.Layout.contact</span><br>
                    </td>
                    
                    }
                    <td class="cl-mid text-center"><a href="@Url.Action("DepositSavingInfo", "DepositSaving", new { SavingDepositID = l.DepositSavingID })" data-role="button" data-icon="arrow-r" data-iconpos="notext" data-theme="c" data-inline="true">@FOResource.UI.Product.Card.lblapply1</a></td>
                </tr>
           
                    lai = 0;


                }
            }
        </tbody>
    </table>
    <div data-role="collapsible" data-theme="b" data-mini="true" data-corners="false" data-content-theme="d">
        <h4>@FOResource.UI.Product.Deposit.depositsavingname</h4>
        <div class="bot-main">
            <div class="bottom_tabbed">
               @Html.Raw(ProDes.Description)
            </div>
            <div class="clr"></div>
        </div>

    </div>
</div>
